/*
 * @Author: Tendo 
 * @Date: 2021-09-24 10:12:35 
 * @param {string} ransomNote
 * @param {string} magazine
 * @return {boolean}
 * @desc 数组当哈希表
 */
var canConstruct = function (ransomNote, magazine) {
    const strArr = new Array(26).fill(0),
        base = "a".charCodeAt();
    for (const s of magazine) {
        strArr[s.charCodeAt() - base]++;
    }
    for (const s of ransomNote) {
        const index = s.charCodeAt() - base;
        if (!strArr[index]) return false;
        strArr[index]--;
    }
    return true;
};